home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / perl5 / Test::Harness.z / Test::Harness
Encoding:
Text File  |  2002-10-03  |  6.0 KB  |  199 lines

  1.  
  2.  
  3.  
  4. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Test::Harness - run perl standard test scripts with statistics
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      use Test::Harness;
  13.  
  14.      _r_u_n_t_e_s_t_s(@tests);
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      (By using the the _T_e_s_t manpage module, you can write test scripts without
  18.      knowing the exact output this module expects.  However, if you need to
  19.      know the specifics, read on!)
  20.  
  21.      Perl test scripts print to standard output "ok N" for each single test,
  22.      where N is an increasing sequence of integers. The first line output by a
  23.      standard test script is "1..M" with M being the number of tests that
  24.      should be run within the test script. _T_e_s_t::_H_a_r_n_e_s_s::_r_u_n_t_e_s_t_s(@tests)
  25.      runs all the testscripts named as arguments and checks standard output
  26.      for the expected "ok N" strings.
  27.  
  28.      After all tests have been performed, _r_u_n_t_e_s_t_s() prints some performance
  29.      statistics that are computed by the Benchmark module.
  30.  
  31.      TTTThhhheeee tttteeeesssstttt ssssccccrrrriiiipppptttt oooouuuuttttppppuuuutttt
  32.  
  33.      Any output from the testscript to standard error is ignored and bypassed,
  34.      thus will be seen by the user. Lines written to standard output
  35.      containing /^(not\s+)?ok\b/ are interpreted as feedback for _r_u_n_t_e_s_t_s().
  36.      All other lines are discarded.
  37.  
  38.      It is tolerated if the test numbers after ok are omitted. In this case
  39.      Test::Harness maintains temporarily its own counter until the script
  40.      supplies test numbers again. So the following test script
  41.  
  42.          print <<END;
  43.          1..6
  44.          not ok
  45.          ok
  46.          not ok
  47.          ok
  48.          ok
  49.          END
  50.  
  51.      will generate
  52.  
  53.          FAILED tests 1, 3, 6
  54.          Failed 3/6 tests, 50.00% okay
  55.  
  56.      The global variable $Test::Harness::verbose is exportable and can be used
  57.      to let _r_u_n_t_e_s_t_s() display the standard output of the script without
  58.      altering the behavior otherwise.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  71.  
  72.  
  73.  
  74.      The global variable $Test::Harness::switches is exportable and can be
  75.      used to set perl command line options used for running the test
  76.      _s_c_r_i_p_t(s). The default value is -w.
  77.  
  78.      If the standard output line contains substring  # Skip (with variations
  79.      in spacing and case) after ok or ok NUMBER, it is counted as a skipped
  80.      test.  If the whole testscript succeeds, the count of skipped tests is
  81.      included in the generated output.
  82.  
  83. EEEEXXXXPPPPOOOORRRRTTTT
  84.      &runtests is exported by Test::Harness per default.
  85.  
  86. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  87.      All tests successful.\nFiles=%d,  Tests=%d, %s
  88.          If all tests are successful some statistics about the performance are
  89.          printed.
  90.  
  91.      FAILED tests %s\n\tFailed %d/%d tests, %.2f%% okay.
  92.          For any single script that has failing subtests statistics like the
  93.          above are printed.
  94.  
  95.      Test returned status %d (wstat %d)
  96.          Scripts that return a non-zero exit status, both $? >> 8 and $? are
  97.          printed in a message similar to the above.
  98.  
  99.      Failed 1 test, %.2f%% okay. %s
  100.  
  101.      Failed %d/%d tests, %.2f%% okay. %s
  102.          If not all tests were successful, the script dies with one of the
  103.          above messages.
  104.  
  105. EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
  106.      Setting HARNESS_IGNORE_EXITCODE makes harness ignore the exit status of
  107.      child processes.
  108.  
  109.      If HARNESS_FILELEAK_IN_DIR is set to the name of a directory, harness
  110.      will check after each test whether new files appeared in that directory,
  111.      and report them as
  112.  
  113.        LEAKED FILES: scr.tmp 0 my.db
  114.  
  115.      If relative, directory name is with respect to the current directory at
  116.      the moment _r_u_n_t_e_s_t_s() was called.  Putting absolute path into
  117.      HARNESS_FILELEAK_IN_DIR may give more predicatable results.
  118.  
  119. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  120.      the _T_e_s_t manpage for writing test scripts and also the _B_e_n_c_h_m_a_r_k manpage
  121.      for the underlying timing routines.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  137.  
  138.  
  139.  
  140. AUTHORS
  141.      Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure
  142.      is, that it was inspired by Larry Wall's TEST script that came with perl
  143.      distributions for ages. Numerous anonymous contributors exist. Current
  144.      maintainer is Andreas Koenig.
  145.  
  146. BBBBUUUUGGGGSSSS
  147.      Test::Harness uses $^X to determine the perl binary to run the tests
  148.      with. Test scripts running via the shebang (#!) line may not be portable
  149.      because $^X is not consistent for shebang scripts across platforms. This
  150.      is no problem when Test::Harness is run with an absolute path to the perl
  151.      binary or when $^X can be found in the path.
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.